package com.situ.day14;

import org.junit.Test;

public class ZhengZeDemo {
	@Test
	public void test1() {
		String regex = "[a-zA-Z0-9_-]+@[a-zA-Z0-9]+(.[a-zA-Z0-9]+)+";
		String mail = "1040565173%@qq.com";
		if (mail.matches(regex)) {
			System.out.println("是邮箱");
		}else {
			System.out.println("不是邮箱");
		}
 	}
	@Test
	public void test2() {
		String regex = "[a-zA-Z0-9_-]+@[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+)+";
		String mail = "yiyongwei159@163.com";
		if (mail.matches(regex)) {
			System.out.println("是邮箱");
		}else {
			System.out.println("不是邮箱");
		}
	}
	@Test
	public void test3() {
		String regex = "";
		String str = "Hello Android Java PHP"; 
		String[] array = str.split(" ");
		for (String string : array) {
			System.out.println(string);
		}
	}
	@Test
	public void test4() {
		String regex = "\\d+";
		String str = "dfghu2344dfhi5644ffdhfi44EHHE35fhdf1235df";
		String[] array = str.split(regex);
		for (String string : array) {
			System.out.println(string);
		}
	}
	@Test
	public void test5() {
		String regex = "\\d+";
		String string = "ehrifdi3456dfhdfhoDSf223dffhfd34hi";
		String result = string.replaceAll(regex, "#NUMBER#");
		System.out.println(result);
	}
	@Test
	public void test6() {
		String regex = "";
		String str = "Hello Android Java PHP";
		String[] array = str.split(" ");
		for (String string : array) {
			System.out.println(string);
		}
	}
	@Test
	public void test7() {
		String regex = "\\d+";
		String str = "dfghu2344dfhi5644ffdhfi44EHHE35fhdf1235df";
		String[] array = str.split(regex);
		for (String string : array) {
			System.out.println(string);
		}
	}
	@Test
	public void test8() {
		String regex = "\\d+";
		String string = "ehrifdi3456dfhdfhoDSf223dffhfd34hi";
		String result = string.replaceAll(regex, "#NUMBER#");
		System.out.println(result);
	}
	@Test
	public void test9() {
		String regex = "\\d+";
		String string = "ehrifdi3456dfhdfhoDSf223dffhfd34hi";
		String result = string.replaceAll(regex, "#NUMBER#");
		System.out.println(result);
	}

}
